use std::sync::Arc;
use crate::{dto, mq};

pub struct ClientManager {
    peer: mq::client::node::endpoint::peer::Client,
    pub wireguard_config: mq::client::node::endpoint::peer::wireguard_config::Client,
}

impl ClientManager {
    pub fn new(client: Arc<mq::client::Client>) -> Self {
        Self {
            peer: mq::client::node::endpoint::peer::Client::new(client.clone()),
            wireguard_config: mq::client::node::endpoint::peer::wireguard_config::Client::new(client),
        }
    }
    pub async fn publish_setup_event(
        &self,
        node_id: &str,
        payload: dto::event::endpoint::peer::SetupEventPayload,
    ) -> Result<(), anyhow::Error> {
        self.peer.publish_setup_event(node_id, payload).await
    }

    pub async fn publish_delete_event(
        &self,
        node_id: &str,
        payload: dto::event::endpoint::peer::DeleteEventPayload,
    ) -> Result<(), anyhow::Error> {
        self.peer.publish_delete_event(node_id, payload).await
    }
}
